# -*- coding:utf-8 -*-
from django.contrib import admin
from models import *

# Register your models here.
class ArticleAdmin(admin.ModelAdmin):
    # 每一篇文章要显示的内容项
    list_display = ('title', 'desc', 'click_count',)
    # 每一篇文章要显示的内容项是否可以点击
    list_display_links = ('title', 'desc', )
    # 每一篇文章要显示的内容项是否可以编辑
    list_editable = ('click_count',)

    # 默认显示，什么内容与点击再显示什么内容
    fieldsets = (
        (None, {
            'fields': ('title', 'desc', 'content', 'user', 'category', 'tag', )
        }),
        ('高级设置', {
            'classes': ('collapse',),
            'fields': ('click_count', 'is_recommend',)
        }),
    )

    # 引入媒体文件，副文本编辑器
    class Media:
        js = (
            '/static/js/kindeditor-4.1.10/kindeditor-min.js',
            '/static/js/kindeditor-4.1.10/lang/zh_CN.js',
            '/static/js/kindeditor-4.1.10/config.js',
        )

admin.site.register(User)
admin.site.register(Tag)
admin.site.register(Article, ArticleAdmin)
admin.site.register(Category)
admin.site.register(Comment)
admin.site.register(Links)
admin.site.register(Ad)